package com.s.core.root.strategy.factor.pics.combination;

import com.google.common.collect.Lists;
import com.s.core.root.data._AllData;
import com.s.core.root.strategy.base.Factor;
import com.s.core.root.strategy.base.Feature;
import com.s.core.root.strategy.factor.pic.combination.F_Pic_LastMaxStrong;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * Pics特征：描述哪些Pic的最后一个Point是Strong且Max
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class F_Pics_LastMaxStrong implements Factor, Feature {
    private List<Integer> ns;

    @Override
    public void process(_AllData allData) {
        List<Integer> picNs = Lists.newArrayList();
        allData.picNMap.values().stream().
                filter(picN -> picN.containFeature(F_Pic_LastMaxStrong.class)).
                forEach(picN -> picNs.add(picN.getN()));
        if (!picNs.isEmpty()) {
            allData.addFeature(new F_Pics_LastMaxStrong(picNs));
        }
    }
}